﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using DataVisit.Model;
using NHibernate;
using System.Collections;
using NHibernate.Transform;

namespace DataVisit.DAL.ReportData.SecurityMarket
{
    public class SecurityMarketDal : AbstractSupportDal<IProjectModel>
    {
        /// <summary>
        /// 查询日常隐患台账
        /// </summary>
        /// <param name="time"></param>
        /// <returns></returns>
        public IList GetEverydayRisks(DateTime time)
        {
            IList list = Session.GetNamedQuery("GetReport")
                .SetString("year", time.Year.ToString())
                .SetString("month", time.Month.ToString())
                .SetResultTransformer(Transformers.AliasToEntityMap).List();
            return list;
        }

        /// <summary>
        /// 被检部门合计
        /// </summary>
        /// <param name="time"></param>
        /// <returns></returns>
        public IList GetCheckDepartments(DateTime time)
        {
            IList list = Session.GetNamedQuery("GetCheckDepartments")
                .SetString("year", time.Year.ToString())
                .SetString("month", time.Month.ToString())
                .SetResultTransformer(Transformers.AliasToEntityMap).List();
            return list;
        }

        /// <summary>
        /// 隐患类别
        /// </summary>
        /// <param name="time"></param>
        /// <returns></returns>
        public IList GetHazardTypes(DateTime time)
        {
            IList list = Session.GetNamedQuery("GetHazardTypes")
                .SetString("year", time.Year.ToString())
                .SetString("month", time.Month.ToString())
                .SetResultTransformer(Transformers.AliasToEntityMap).List();
            return list;
        }

        /// <summary>
        /// 地理位置
        /// </summary>
        /// <param name="time"></param>
        /// <returns></returns>
        public IList GetLocations(DateTime time)
        {
            IList list = Session.GetNamedQuery("GetLocations")
                .SetString("year", time.Year.ToString())
                .SetString("month", time.Month.ToString())
                .SetResultTransformer(Transformers.AliasToEntityMap).List();
            return list;
        }

        /// <summary>
        /// 隐患级别
        /// </summary>
        /// <param name="time"></param>
        /// <returns></returns>
        public IList GetHazardLevel(DateTime time)
        {
            IList list = Session.GetNamedQuery("GetHazardLevel")
                .SetString("year", time.Year.ToString())
                .SetString("month", time.Month.ToString())
                .SetResultTransformer(Transformers.AliasToEntityMap).List();
            return list;
        }
    }
}
